from todo_api_project.base.mybase import Tools


class create_model(Tools):
    # 定义路径
    path = '/task/info'

    # 发送创建任务接口
    def create_action(self, title, hd):
        create_data = {
            "title": title
        }
        create = self.huihua.post(url=self.hosturl+self.path, data=create_data, headers=hd)
        return create.json()


from todo_api_project.api.login_api import login_model
import requests
s = requests.session()
login = login_model(huihua=s)
msg = login.login_action(usr='rrer123', pwd='rr1234', check='1234')
print(msg)
getuserId = msg['userId']
getuserToken = msg['userToken']
print(getuserToken)
hd = {"userId": getuserId, "userToken": getuserToken}

create = create_model(huihua=s)
msg = create.create_action(title='hhhwwwwrrr', hd=hd)
print(msg)
